<template>
	<view class="container">
		<!-- 文创产品 -->
		<view class="info">
			<view class="info-des">
				<view class="label">
					<text>文创产品</text>
					<view class="shadow"></view>
				</view>
				<view class="des">
					<text>发掘更多有趣文创</text>
					<view class="point">
						<view class="trangle"></view>
					</view>
				</view>
			</view>
			<view class="product_list">
				<view class="list_item" v-for="(item, index) in productList" :key="index">
					<image :src="item.coverImage" mode="aspectFill" class="list_img"></image>
					<view class="list_text">
						<view class="title">
							<text>{{ item.goodsName }}</text>
						</view>
						<view class="bottom">
							<view class="price">
								<text class="price_num">￥{{ item.price }}</text>
							</view>
							<view class="btn" @click="toPage(item)">
								<text>立即购买></text>
							</view>
						</view>
					</view>
				</view>
				<!-- <view v-if="productList.length == 0" style="margin-top: 30rpx; text-align: center; width: 732rpx">暂无数据</view> -->
				<view v-if="productList.length == 0" style="width: 732rpx; text-align: center; margin-top: 200rpx">
					<image
						style="width: 500rpx"
						mode="widthFix"
						src="https://zrws-1327345771.cos.ap-shanghai.myqcloud.com/images/1734702481602ONCKpkWwYg0g4d9d4ebe77ff36c5ee1a1590746db1fb.png"
					/>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import indexApi from '@/api/yanxue/indexPage'
export default {
	data() {
		return {
			productList: [
				// {
				//   url: "https://zrws-1327345771.cos.ap-shanghai.myqcloud.com/yanxue/index_item1.png",
				//   title: "LINKOOL花猫款 防嗮黑胶晴雨伞",
				//   price: 128,
				// },
				// {
				//   url: "https://zrws-1327345771.cos.ap-shanghai.myqcloud.com/yanxue/index_item1.png",
				//   title: "LINKOOL花猫款 防嗮黑胶晴雨伞",
				//   price: 128,
				// },
				// {
				//   url: "https://zrws-1327345771.cos.ap-shanghai.myqcloud.com/yanxue/index_item1.png",
				//   title: "LINKOOL花猫款 防嗮黑胶晴雨伞",
				//   price: 128,
				// },
				// {
				//   url: "https://zrws-1327345771.cos.ap-shanghai.myqcloud.com/yanxue/index_item1.png",
				//   title: "LINKOOL花猫款 防嗮黑胶晴雨伞",
				//   price: 128,
				// },
			]
		}
	},
	methods: {
		init() {
			this.getDatalist()
			// this.getHotList();
		},
		getDatalist() {
			indexApi.getGoodsList({ categoryId: 4, page: 1, rows: 100 }).then(res => {
				this.productList = res.result.list
			})
		},
		toPage(item) {
			this.$navTo('pagesA/cultural/cultural_detail?id=' + item.id)
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	background-color: #f5f5f5;
	padding: 0 24rpx 100rpx;
}

.info {
	// margin-top: 46rpx;
	padding-top: 28rpx;

	.info-des {
		display: flex;
		align-items: center;
		justify-content: space-between;

		.label {
			position: relative;

			text {
				font-family: HarmonyOS Sans SC;
				font-weight: 900;
				font-size: 38rpx;
				color: #000000;
				z-index: 100;
			}

			.shadow {
				margin-top: -12rpx;
				z-index: 99;
				width: 100%;
				height: 8rpx;
				background: #a2ff00;
			}
		}

		.des {
			display: flex;
			align-items: center;

			text {
				font-family: HarmonyOS Sans SC;
				font-weight: 400;
				font-size: 24rpx;
				transform: scale(0.916667);
				color: #747474;
			}

			.point {
				position: relative;
				margin-left: 10rpx;
				width: 20rpx;
				height: 20rpx;
				background-color: #a2ff00;
				border-radius: 50%;

				.trangle {
					position: absolute;
					top: 4rpx;
					left: 4rpx;
					// transform: translate(-50%, -50%);
					width: 0;
					height: 0;
					border-left: 8rpx solid transparent;
					border-right: 8rpx solid transparent;
					border-bottom: 13.856rpx solid #fff;
					transform: rotate(90deg);
				}
			}
		}
	}

	.product_list {
		margin-top: 30rpx;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		grid-gap: 28rpx;
		.list_item {
			width: 344rpx;
			height: 430rpx;
			background: #f95513;
			border-radius: 20rpx;
			float: left;
			display: inline-block;
			padding: 14rpx;
			.list_img {
				width: 316rpx;
				height: 316rpx;
				display: block;
			}
			.list_text {
				.title {
					text {
						font-size: 24rpx;
						font-family: HarmonyOS Sans SC;
						color: #ffffff;
						transform: scale(0.833333);
						display: block;
						width: 133.33%;
						margin-left: -36rpx;
					}
				}
				.bottom {
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 14rpx;
					.price {
						.price_num {
							font-family: HarmonyOS Sans SC;
							font-size: 26rpx;
							color: #ffffff;
						}
					}
					.btn {
						width: 114rpx;
						height: 34rpx;
						background: #a2ff00;
						border-radius: 18rpx;
						text {
							font-family: HarmonyOS Sans SC;
							font-size: 24rpx;
							color: #f95513;
							text-align: center;
							line-height: 34rpx;
							transform: scale(0.75);
							display: block;
						}
					}
				}
			}
		}
	}
}
</style>
